package Controller;

import java.io.File;

import libs.FileUtils;
import libs.TUIO.TuioClient;
import libs.TUIO.TuioCursor;
import libs.TUIO.TuioListener;
import libs.TUIO.TuioObject;
import libs.TUIO.TuioTime;
import Controller.Action.BackAction;
import Controller.Action.CollpaseAction;
import Controller.Action.ExpandAction;
import Controller.Action.InterruptAction;
import Controller.Action.LoadAction;
import Controller.Action.PlayAction;
import Controller.Action.SaveAction;
import Controller.Action.SelectDirectoryAction;
import Controller.Action.SkipAction;
import Controller.Action.StopAction;
import View.FileDirChooserFrame;
import View.MainWindow;

public class ActionController implements TuioListener{
	public StopAction _unnamed_StopAction_ = new StopAction();
	public LoadAction _unnamed_LoadAction_ = new LoadAction();
	public ExpandAction _unnamed_ExpandAction_ = new ExpandAction();
	public CollpaseAction _unnamed_CollpaseAction_ = new CollpaseAction();
	public SelectDirectoryAction _unnamed_SelectDirectoryAction_ = new SelectDirectoryAction();
	public PlayAction _unnamed_PlayAction_ = new PlayAction();
	public SkipAction _unnamed_SkipAction_ = new SkipAction();
	public BackAction _unnamed_BackAction_ = new BackAction();
	public InterruptAction _unnamed_InterruptAction_ = new InterruptAction();
	public SaveAction _unnamed_SaveAction_ = new SaveAction();
	public MouseController mouseCtrl = new MouseController();

	private MainWindow mainFrame;

	// main Methode hier:
	public static void main(String args[]) {
		new ActionController();
	}

	public ActionController() {
		mainFrame = new MainWindow(this);
		mouseCtrl.mainWindow = mainFrame;

		TuioClient client = new TuioClient();
		client.addTuioListener(this);
		client.connect();

		// entweder oder, beides geht nicht
//		mainFrame.startFullscreen();
//		mainFrame.startMaxedScreen();
		mainFrame.startActualRealSize();
		mainFrame.getFileDirChoFrame().checkForButts();
        mainFrame.getFileDirChoFrame().startDirEtc();
	}

	@Override
	public void addTuioCursor(TuioCursor tcur) {		
		mouseCtrl.addCursor(tcur);
	}

	@Override
	public void addTuioObject(TuioObject tobj) {
		if(mainFrame.isFullScreenEnabled() == false)
			mainFrame.repaint();
		}

	@Override
	public void refresh(TuioTime ftime) {}

	@Override
	public void removeTuioCursor(TuioCursor tcur) {
		mouseCtrl.removeCursor(tcur);
	}

	@Override
	public void removeTuioObject(TuioObject tobj) {
		if(mainFrame.isFullScreenEnabled() == false)
			mainFrame.repaint();
	}

	@Override
	public void updateTuioCursor(TuioCursor tcur) {
		mouseCtrl.updatePosition(tcur);
	}

	@Override
	public void updateTuioObject(TuioObject tobj) {
		if(mainFrame.isFullScreenEnabled() == false)
			mainFrame.repaint();
	}
	
	
}